#from django.db import models
from google.appengine.ext import db
from google.appengine.api import users

from musiclib.models import Music

# Create your models here.
class Movie(db.Model):
    name = db.StringProperty()
    doubanid = db.StringProperty()
    jsondesp = db.StringProperty()#desp img,director,protagonist
    addtime = db.DateTimeProperty(auto_now=True)
    modifytime = db.DateTimeProperty(auto_now=True)

class MovieMusicLink(db.Model):
    movie = db.ReferenceProperty(Movie)
    music = db.ReferenceProperty(Music)
    jsondesp = db.StringProperty()#desp,start time, end time


class UserAddAction(db.Model):
    """
    user attach a music to a movie
    """
    user = db.UserProperty()
    movie = db.ReferenceProperty(Movie)
    music = db.ReferenceProperty(Music)
    actiondesp = db.StringProperty()

class UserQuery(db.Model):
    """
    to store user query and analysis users preference
    """
    query = db.StringProperty()
